<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var obj = {
            name:'xiaoxue',
            age:18,
            sex:'boy',
            playGame:function(){
                console.log('huoyin~');
            }
        }
        for(var k in obj){
            console.log(k) //输出属性名
            console.log(obj[k]) //输出属性值
        }
    </script>
</body>
</html>